home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / listings / v_01_06 / 1n06042b < prev    next >
Text File  |  1990-09-29  |  420b  |  26 lines

  1.  
  2. Listing 10
  3.  
  4. {*
  5.  * read_id skips whitespace character and reads an
  6.  * identifier from file f into string s.
  7.  *}
  8. procedure read_id(var f : text; var s : string);
  9.     var
  10.         c : char;
  11.     begin
  12.     s := '';
  13.     if seekeof(f) then
  14.         ;
  15.     read(c);
  16.     if c in ['A'..'Z', 'a'..'z', '_'] then
  17.         begin
  18.         repeat
  19.             s := s + c;
  20.             read(c);
  21.         until not (c in ['A'..'Z', 'a'..'z', '0'..'9', '_']);
  22.         end;
  23.     unread(f);
  24.     end;
  25.  
  26.